package com.wkhyapp.lm.view;

import android.Manifest;
import android.content.pm.PackageManager;
import android.os.Build;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import com.wkhyapp.lm.MainActivity;
import com.wkhyapp.lm.R;
import com.wkhyapp.lm.base.BaseActivity;
import com.wkhyapp.lm.constant.Constant;
import com.wkhyapp.lm.utils.FileUtils;
import com.wkhyapp.lm.utils.ImgDonwloads;
import com.wkhyapp.lm.utils.StatusBarFontUtil;

import butterknife.BindView;

public class ShareAppActivity extends BaseActivity {


    @BindView(R.id.back_iv)
    ImageView backiv;
    @BindView(R.id.save_but)
    Button save;

    @Override
    public void initUI() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            translucentStatusBar();
        }
        StatusBarFontUtil.setLightStatusBarColor(this);
    }

    @Override
    protected void initListener() {

        backiv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        save.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.M &&
                       checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED) {
                    requestPermissions(new String[]{
                            Manifest.permission.READ_EXTERNAL_STORAGE,
                            Manifest.permission.WRITE_EXTERNAL_STORAGE},1);
                }else{
                    System.out.println("---"+ FileUtils.makeDirs(Constant.appFilePatch));
                    System.out.println("---"+ FileUtils.makeDirs(Constant.imagFilePatch));

                    ImgDonwloads.donwloadImg(mContext, "http://app-img.wkhyw.com/ewm.jpg");
                }
            }
        });

    }


    @Override
    protected int getLayoutId() {
        return R.layout.activity_share_app;
    }


    @Override
    protected void afterCreate() {

    }
}
